package com.lu.component.http.proxy.config;

import com.lu.component.rpc.model.enums.RpcFlowControlEnum;

/**
 * 客户端配置
 *
 * @author: zhanglu
 * @date: 2023/7/6 17:48
 * @modify: 修改人信息, 修改内容 2023/7/6 17:48
 */
public final class RpcClientProperties {

    /**
     * 超时时间 单位ms
     */
    private Long timeout;

    /**
     * 全局限流限流
     */
    private Limit limit;

    public Long getTimeout() {
        return timeout;
    }

    public void setTimeout(Long timeout) {
        this.timeout = timeout;
    }

    public Limit getLimit() {
        return limit;
    }

    public void setLimit(Limit limit) {
        this.limit = limit;
    }

    /**
     * 限流
     */
    public static class Limit{
        /**
         * 限流策略
         */
        private RpcFlowControlEnum rpcFlowControlEnum;
        /**
         * 每秒吞吐量
         */
        private Integer permits;

        public Limit(RpcFlowControlEnum rpcFlowControlEnum, Integer permits){
            this.rpcFlowControlEnum = rpcFlowControlEnum;
            this.permits = permits;
        }

        public RpcFlowControlEnum getRpcFlowControlEnum() {
            return rpcFlowControlEnum;
        }

        public Integer getPermits() {
            return permits;
        }
    }

}
